package com.homson.coreservice.servicecommon.enumeration;

/**
 * @author: homson_leo
 * @contact: hey_超级巨星（Homson_Leo）- 刘泓岑 1196816884@qq.com
 * @time: 2025/10/20 11:38 PM
 **/
public enum CurrencyEnum {
    
    CNY( 1, "人民币","CNY"),
    USD( 2, "美元","USD"),
    HKD( 3, "港币","HKD");
    
    
    private Integer code;
    private String currencyName;
    private String currencyEnName;
    
    CurrencyEnum(Integer code, String currencyName, String currencyEnName) {
        this.code = code;
        this.currencyName = currencyName;
        this.currencyEnName = currencyEnName;
    }
    
    public Integer getCode() {
        return code;
    }
    
    public String getCurrencyName() {
        return currencyName;
    }
    
    public String getCurrencyEnName() {
        return currencyEnName;
    }
    
    public static CurrencyEnum of(Integer code) {
        for(CurrencyEnum currency: CurrencyEnum.values()){
            if(currency.getCode().equals(code)){
                return currency;
            }
        }
        return null;
    }
}
